from flask import Blueprint, request, jsonify
from tools.loggerHander import Logger

# 创建API蓝图对象
api_bp = Blueprint('api', __name__, url_prefix='/api')
logger = Logger()


@api_bp.route('/data', methods=['GET'])
def get_data():
    # 处理数据获取逻辑
    params = request.args.to_dict()
    logger.info(f"获取数据请求: {params}")
    return jsonify({"code": "000", "msg": "success", "data": params})


@api_bp.route('/process', methods=['POST'])
def process_data():
    # 处理数据处理逻辑
    data = request.json
    logger.info(f"处理数据请求: {data}")
    return jsonify({"code": "000", "msg": "数据处理完成", "data": data})
